using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Text;
using System.Windows.Forms;
using DevExpress.XtraEditors;
using DAL;
using BLL;
using DTO;

namespace WellmeadowsHospital
{
    public partial class frmSearchListWait : DevExpress.XtraEditors.XtraUserControl
    {
        AppointmentBLL appointmentBLL = new AppointmentBLL();
        WardBLL wardBLL = new WardBLL();
        PatientBLL patientBLL = new PatientBLL();
        ListWaitBLL listwaitBLL = new ListWaitBLL();
        public frmSearchListWait()
        {
            InitializeComponent();
            gcListWaitinSearchListWaitH.DataSource = listwaitBLL.SearchALLWithPatient();
            gcWardListinSearchListWaitH.DataSource = wardBLL.SelectAllWard();
        }

        private void textEdit85_KeyPress(object sender, KeyPressEventArgs e)
        {
            string key = textEdit85.Text;
            if (!key.Equals(""))
            {
                gcListWaitinSearchListWaitH.DataSource = listwaitBLL.SearchWithPatient(key);
            }
            if (key.Equals(""))
            {
                gcListWaitinSearchListWaitH.DataSource = listwaitBLL.SearchALLWithPatient();
            }
        }

        private void gridView27_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e)
        {
            try
            {
                string mapa = gridView27.GetRowCellValue(gridView27.GetSelectedRows()[0], gcolPatientIDinSearchListWait).ToString();
                gcPatientinSearchListWaitH.DataSource = patientBLL.Search(mapa);
            }
            catch (Exception ee)
            {
                MessageBox.Show(ee.Message);
            }
        }
    }
}
